//
//  NetworkManger+MedicineManger.m
//  DeepBreathing
//
//  Created by rimi on 15/12/19.
//  Copyright © 2015年 rimi. All rights reserved.
//

#import "NetworkManger+MedicineManger.h"

@implementation NetworkManger (MedicineManger)

+(void)getMedicineListWith:(NSInteger)page pageSize:(NSInteger)pageSize successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *pramas123 = @{@"page":[NSString stringWithFormat:@"%ld",page],@"pageSize":[NSString stringWithFormat:@"%ld",pageSize]};
    
    [self postWithUrl:@"app/medicine/getMedicList.html" params:[self parasByappendingUserInfo:pramas123] successHander:success failureHander:failure];
    
    
    
}
//扫码添加药品
+(void)sweepQRcodeToAddMedicineWith:(NSString *)barcode successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *pramas123 = @{@"barcode":barcode};
    [self postWithUrl:@"/app/ medicine/addMedicByC.html" params:[self parasByappendingUserInfo:pramas123] successHander:success failureHander:failure];
    
    
    
    
}
//根据药品名查询药物
+(void)accordingTheNameOfMedicineToSearchMedicineWith:(NSString *)name page:(NSInteger)page pageSize:(NSInteger)pageSize successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *params123 = @{@"name":name,@"page":[NSString stringWithFormat:@"%ld",page],@"pageSize":[NSString stringWithFormat:@"%ld",pageSize]};
    
    [self postWithUrl:@"app/medicine/searchMedic.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}
//用户添加药物
+(void)userAddMedicineWith:(NSString *)medicId successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *params123 = @{@"medicId":medicId};
    
    [self postWithUrl:@"app/medicine/addMedic.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}
//药品详情
+(void)messageOfMedicineWith:(NSString *)Id successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *params123 = @{@"medicId":Id};
    
    [self postWithUrl:@"app/medicine/medicDetail.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}
//添加提醒
+(void)addwarnTimeWith:(NSString *)Id time:(NSString *)time successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    NSDictionary *params123 = @{@"id":Id,@"time":time};
    
    [self postWithUrl:@"app/medicine/addNotice.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}
//获取提醒列表（提醒时间不为空时获取）
+(void)getWarnTimeListWithMedicId:(NSString *)medicid successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *parmas123 = @{@"medicId":medicid};
    
    [self postWithUrl:@"app/medicine/getNoticeList.html" params:[self parasByappendingUserInfo:parmas123] successHander:success failureHander:failure];
}
//关闭或打开单个提醒
+(void)openOrCloseSingleWarnWithId:(NSString *)Id status:(NSInteger)status successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *params23 = @{@"id":Id,@"status":[NSString stringWithFormat:@"%ld",status]};
    
    [self postWithUrl:@"app/medicine/closeNotice.html" params:[self parasByappendingUserInfo:params23] successHander:success failureHander:failure];
    
}
//关闭或者打开所有提醒
+(void)openOrCloseAllWarnWithMedicId:(NSString *)medisId status:(NSInteger)status successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *params123 =@{@"medicId":medisId,@"status":[NSString stringWithFormat:@"%ld",status]};
    
    [self postWithUrl:@"app/medicine/closeAllNotice.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}
//删除提醒
+(void)deleteMedicineTimeWithMedicId:(NSString *)medicId successHander:(SuccessHander)success failureHander:(FailureHander)failure;{
    
    NSDictionary *params123 = @{@"id":medicId};
    
    [self postWithUrl:@"app/medicine/delNotice.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}

//删除药品
+(void)deleteMedicineWithMedicId:(NSString *)medicId successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    NSDictionary *params123 = @{@"medicId":medicId};
    
    [self postWithUrl:@"app/medicine/delMedic.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}
//初次进入药品搜索页返回药品列表
+(void)firstToSearchThenBackMedicineListWithPage:(NSInteger)page pageSize:(NSInteger)pageSize successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *params123 = @{@"page":[NSString stringWithFormat:@"%ld",page],@"pageSize":[NSString stringWithFormat:@"%ld",pageSize]};
    
    [self postWithUrl:@"app/medicine/loadAllMedic.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}
//修改药物提醒时间
+(void)changeTheTimeOfWarnWithId:(NSString *)Id time:(NSString *)time successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    NSDictionary *params123 = @{@"id":Id,@"time":time};
    
    [self postWithUrl:@"app/medicine/updateNoTime.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
    
}
//扫码获取药品信息
+(void)sweepQRcodeToGetMedicineMessageWith:(NSString *)barcode successHander:(SuccessHander)success failureHander:(FailureHander)failure{
    
    
    
    NSDictionary *params123 = @{@"barcode":barcode};
    
    [self postWithUrl:@"app/medicine/getNameByC.html" params:[self parasByappendingUserInfo:params123] successHander:success failureHander:failure];
}


@end
